<template>
    <a-card :bordered="false">
        <div class="table-operator">
            <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'templateForm','新增')">添加</a-button>
        </div>

        <LTable
        ref="templateList"
        size="small"
        rowKey="templateId"
        :formAttributes="formAttributes"
        :columns="columns"
        axiosUrl="/SysImportTemplateController/page"
        :initQuery="[{field:'systemNo',val:defaultSettings.systemNo}]"
        :showPagination="true"
        :showQueryForm="true"
      >
    
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'templateForm',record.templateName)">编辑</a>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete({templateId:record.templateId},'/SysImportTemplateController/del','templateList')">
                  <a>删除</a>
            </a-popconfirm>
        </span>
        
    </LTable>

    <templateForm ref="templateForm" @close="refresh('templateList')" @ok="refresh('templateList')"></templateForm> 
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable'
import templateForm from './templateForm'
import {SysMixin} from '@/mixins/SysMixin'
import defaultSettings from '@/config/defaultSettings'

export default {
    name:'templateList',
    components:{
       LTable,templateForm
    },
    mixins:[SysMixin],
    data(){
        return{
            formAttributes:[
                {field:'templateName',label:'模板名称',component:'input',condition:'like'},
            ],
            defaultSettings,
            columns:[
                {
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                {
                    title: '模板编号',
                    dataIndex: 'templateId'
                    
                },
               
                {
                    title: '模板名称',
                    dataIndex: 'templateName'
                    
                },
                {
                    title: '实体名称',
                    dataIndex: 'entityClassName'
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '120px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            
        }
    },
    
}
</script>